from django.conf.urls import url
from django.contrib.auth.decorators import login_required

from . import views


urlpatterns = [
    # 注册
    url(r'^register/$', views.RegisterView.as_view(), name='register'),
# 用户是否重复注册
    url(r'^usernames/(?P<username>[a-zA-Z0-9_-]{5,20})/count/$', views.UsernameCountView.as_view()),
    # 手机号重复
    url(r'^mobiles/(?P<mobile>1[3-9]\d{9})/count/$', views.MobileCountView.as_view()),
    # 用户登录
    url(r'^login/$', views.LoginView.as_view(),name='login'),
    #  用户退出
    # url(r'logout$',views.LogoutView.as_view(),name='logout')
    url(r'^logout/$', views.LogoutView.as_view()),
    # 用户中心显示
    url(r'^info/$', views.InfoView.as_view()),
    # # 用户中心
    # url(r'^info/$', views.InfoView.as_view()),
    # 设置用户邮箱
    url(r'^emails/$',views.EmailView.as_view()),
    # 邮箱激活
    url(r'^emails/verification/$',views.EmailVerifyView.as_view()),
    # 个人中心收获地址
    url(r'^addresses/$',views.AddressesView.as_view()),
    # 新增收获地址
    # url(r'^addresses/create/$', views.AddressCreateView.as_view()),
    url(r'^addresses/create/$', views.AddressCreateView.as_view()),

    # 修改收获地址
    url(r'^addresses/(?P<address_id>\d+)/$', views.UpdateDestroyAddressView.as_view()),
    # 修改地址标题
    url(r'^addresses/(?P<address_id>\d+)/title/$', views.UpdateTitleAddressView.as_view()),
    # 修改默认地址
    url(r'^addresses/(?P<address_id>\d+)/default/$', views.UserDefaultAddressView.as_view()),
    # 修改密码
    url(r'^password/$', views.ChangeUserPasswordView.as_view()),
    # 用户浏览记录
    url(r'^browse_histories/$', views.UserBrowseHistory.as_view()),
    url(r'^orders/info/(?P<page_num>\d+)/$', views.UserAllOrder.as_view()),
    # url(r'^orders/comment/?order_id=(?P<order_id>\d{22})/$',views.CommentView.as_view()),
    url(r'^orders/comment/$',views.CommentView.as_view())


]